﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="menulist.aspx.cs" Inherits="weikeweixin.web.admin.wechat.menulist" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta content="IdeaSoft软件" name="Keywords">
	<meta content="IdeaSoft软件二维码" name="Description">
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/bootstrap.min.css" />
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/bootstrap.responsive.min.css" />
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/style.css" />
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/todc_bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/themes.css" />
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/inside.css" />
 
    <script type="text/javascript" src="/Scripts/JQuery.min.js"></script>
    <script type="text/javascript" src="/Scripts/Bootstrap.min.js"></script>
    <script type="text/javascript" src="/Scripts/JQuery.cookie.js"></script>
    <script type="text/javascript" src="/Scripts/JQuery.form.wizard.min.js"></script>
    <script type="text/javascript" src="/Scripts/Inside.js"></script>
    <script src="/Scripts/Su.common.js" type="text/javascript"></script>

<title>IdeaSoft软件</title>
</head>
<body>
	
    <div id="main">
        <div class="container-fluid">

            <div class="row-fluid">
                <div class="span12">

                    <div class="box">

                        <div class="box-title">
                            <div class="span10">
                                <h3><i class="icon-edit"></i>菜单管理</h3>
                            </div>
                            <%if (!string.IsNullOrEmpty(Request.QueryString["layid"]))
                              { %>
                              <div class="span2">
                                <a class="btn" href="menulist.aspx">返回一级图文列表</a></div>
                              
                              <%} %>
                        </div>
                        <div class="box-content">
                            <div class="alert" style="display:none;">
                                1.进行中或已经结束的特权不可以修改！<br>
                                2.您最多可以创建8条特权!
                            </div>
                            <div class="row-fluid">
                                <div class="span12 control-group">
                                    <div class="span4">
                                    <%if (string.IsNullOrEmpty(Request.QueryString["layid"]))
                                      { %>
                                        <a class="btn" style="height:21px;" href="menuadd.aspx"><i class="icon-plus"></i>添加菜单</a>
                                        <a class="btn" style="height:21px;" href="javascript:fabu()">发布菜单</a>
                                        <%}
                                      else
                                      { %>
                                      <a class="btn" href="menuadd.aspx?layid=<%=Request.QueryString["layid"] %>"><i class="icon-plus"></i>添加二级菜单</a>
                                      <input type="hidden" id="layid" value="<%=Request.QueryString["layid"] %>" />
                                        <%} %>
                                        <a class="btn" style="height:21px;" href="javascript:location.reload()"><i class="icon-refresh"></i></a>
                                    </div>
                                </div>
                            </div>

                            <div class="row-fluid dataTables_wrapper">
                                <table id="listTable" class="table table-bordered   table-hover  dataTable">
                                    <thead>
                                        <tr>
                                            <th>菜单名称</th>
                                            <th>菜单类型</th>
                                            <th>序号</th>
                                            <th>新增时间</th>
                                            <th>操作</th>
                                        </tr>
                                    </thead>
                                    <tbody>

                                    </tbody>
                                </table>

		                        <div class="dataTables_paginate paging_full_numbers"><span>       </span></div>
                            </div>
                        </div>
                    </div>
                </div>

            </div>
        </div>
    </div>


	
</body>
</html>

<script type="text/javascript">
    $(document).ready(function () {
        var url = "menulist.aspx";
        $.ajax({
            url: url + "?action=menulist",
            type: "post",
            data: { layid: $("#layid").val() },
            success: function (msg) {
                msg = eval("(" + msg + ")");
                var str = "";
                for (var i = 0; i < msg.length; i++) {
                    str += '<tr><td>' + msg[i].caidan_name + '</td><td style="width:450px">' + gettype(msg[i].caidan_type) + '</td>';
                    str += '<td>' + msg[i].caidan_order + '</td><td>' + msg[i].caidan_addtime + '</td><td>';
                    if (msg[i].caidan_layid == 0) {
                        str += '<a href="menulist.aspx?layid=' + msg[i].caidan_id + '" class="btn" rel="tooltip" title="查看二级菜单">查看二级菜单</a>';
                        str += '<a href="menuadd.aspx?id=' + msg[i].caidan_id + '" class="btn" rel="tooltip" title="编辑">编辑</a>';
                        str += '<a href="javascript:Delete(' + msg[i].caidan_id + ')" class="btn" rel="tooltip" attr="delannounce_29393_" title="删除">删除</td></tr>';
                    } else {
                        str += '<a href="menuadd.aspx?layid=' + msg[i].caidan_layid + '&id=' + msg[i].caidan_id + '" class="btn" rel="tooltip" title="编辑">编辑</a>';
                        str += '<a href="javascript:Delete1(' + msg[i].caidan_id + ',' + msg[i].caidan_layid + ')" class="btn" rel="tooltip" attr="delannounce_29393_" title="删除">删除</td></tr>';
                    }
                }
                $("#listTable").append(str);
            }
        });
    })
    function gettype(type) {
        switch (type) {
            case "view":
                return "链接";
            case "click":
                return "图文";
        }
    }
    function Delete(Id) {
        G.ui.tips.confirm("确定要删除吗？", "menulist.aspx?action=del&Id=" + Id);
    }
    function Delete1(Id, layid) {
        G.ui.tips.confirm("确定要删除吗？", "menulist.aspx?action=del&Id=" + Id + "&layid=" + layid);
    }
    function fabu() {
        G.ui.tips.confirm("确定要发布菜单吗？", "menulist.aspx?action=fa");
    }
    </script>